var GGSHOP = {};
GGSHOP.slide = {
    len: $(".bigl-ad > a").length,
    index: 1,
    adTimer: null,                    
    clear: function(){
        clearInterval(this.adTimer);
    },
    showImg: function() {
        if(this.index == this.len){this.index = 0;}                  
        $(".bigl-ad a").filter(":visible").hide().parent().children().eq(this.index).fadeIn(1000);
        $(".middler .simg img").each(function(){
            if (GGSHOP.slide.index == $(this).parent().index()) {
                $(this).css('border', '#CCCCCC 1px solid');        
            } else {
                $(this).css('border', '#000000 1px solid');    
            }
        });        
        this.index++;   
    },
    init: function(){
        $(".bigl-ad a:not(:first-child)").hide(); 
        this.setTimer();  
        this.hover();                     
    },
    setTimer: function(){
        this.adTimer = setInterval(function(){GGSHOP.slide.showImg()}, 3000);
    },
    hover: function(){
        $(".middler .simg img").each(function(){        	
            $(this).bind('mouseover',function(){
                GGSHOP.slide.clear();
                GGSHOP.slide.index = $(this).parent().index();                
                GGSHOP.slide.showImg();
                $(this).css('border', '#CCCCCC 1px solid');                                
            });
            $(this).mouseout(function(){
                GGSHOP.slide.setTimer();
                $(this).css('border', '#000000 1px solid');                                
            });
        });
    }
};
